\hypertarget{class_config_file_parser}{
\section{ConfigFileParser Class Reference}
\label{class_config_file_parser}\index{ConfigFileParser@{ConfigFileParser}}
}
{\tt \#include $<$ConfigFileParser.h$>$}

\subsection*{Classes}
\begin{CompactItemize}
\item 
struct \hyperlink{struct_config_file_parser_1_1_conversion_error}{ConversionError}
\item 
class \textbf{Error}
\item 
struct \hyperlink{struct_config_file_parser_1_1_file_not_created}{FileNotCreated}
\begin{CompactList}\small\item\em Exception types when the file can't be created. \item\end{CompactList}\item 
struct \hyperlink{struct_config_file_parser_1_1_file_not_found}{FileNotFound}
\begin{CompactList}\small\item\em Exception types when the file is not found. \item\end{CompactList}\item 
struct \hyperlink{struct_config_file_parser_1_1_key_not_found}{KeyNotFound}
\begin{CompactList}\small\item\em Exception types when a key is not found. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
\hypertarget{class_config_file_parser_6555fb09bbc989c1a34512812020ad78}{
typedef map$<$ string, string $>$::iterator \hyperlink{class_config_file_parser_6555fb09bbc989c1a34512812020ad78}{mapi}}
\label{class_config_file_parser_6555fb09bbc989c1a34512812020ad78}

\begin{CompactList}\small\item\em Redefinition of iterators types to faciliate navigation in \_\-contents. \item\end{CompactList}\item 
\hypertarget{class_config_file_parser_ed028092d37c9178479d1cacc8e036d7}{
typedef map$<$ string, string $>$::const\_\-iterator \textbf{mapci}}
\label{class_config_file_parser_ed028092d37c9178479d1cacc8e036d7}

\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hypertarget{class_config_file_parser_babdbb96452d3e39677e434b3439f6df}{
\hyperlink{class_config_file_parser_babdbb96452d3e39677e434b3439f6df}{ConfigFileParser} ()}
\label{class_config_file_parser_babdbb96452d3e39677e434b3439f6df}

\begin{CompactList}\small\item\em Default constructor without a file. \item\end{CompactList}\item 
\hyperlink{class_config_file_parser_418798f2424b5afee0ed1af984080d30}{ConfigFileParser} (const string \&filename, const string \&delimiter=\char`\"{}=\char`\"{}, const string \&comment=\char`\"{}\#\char`\"{})
\begin{CompactList}\small\item\em Main constructor with a file name. \item\end{CompactList}\item 
void \hyperlink{class_config_file_parser_a1acd10524fbfc549c4ae1c6460aff20}{read} (const string \&filename)
\begin{CompactList}\small\item\em Read the configuration file (in case you used the default constructor). \item\end{CompactList}\item 
\hypertarget{class_config_file_parser_4c3f53dd1f09f1d900a97942275bc347}{
string \textbf{getFilename} () const }
\label{class_config_file_parser_4c3f53dd1f09f1d900a97942275bc347}

\item 
\hypertarget{class_config_file_parser_88f7ccd67b8f9f91ceed2c88ba50a686}{
string \textbf{getDelimiter} () const }
\label{class_config_file_parser_88f7ccd67b8f9f91ceed2c88ba50a686}

\item 
\hypertarget{class_config_file_parser_c0b48138c8a444b99ea59a145eeee675}{
string \textbf{getCommentIntroducer} () const }
\label{class_config_file_parser_c0b48138c8a444b99ea59a145eeee675}

\item 
\hypertarget{class_config_file_parser_46ee14387a76d513eaeb32f179b60ecb}{
mapci \hyperlink{class_config_file_parser_46ee14387a76d513eaeb32f179b60ecb}{find} (const string \&key) const }
\label{class_config_file_parser_46ee14387a76d513eaeb32f179b60ecb}

\begin{CompactList}\small\item\em Find key. \item\end{CompactList}\item 
\hypertarget{class_config_file_parser_e6719570cc318606cdf426ade7c62009}{
\hyperlink{class_config_file_parser_6555fb09bbc989c1a34512812020ad78}{mapi} \textbf{find} (const string \&key)}
\label{class_config_file_parser_e6719570cc318606cdf426ade7c62009}

\item 
{\footnotesize template$<$class T $>$ }\\T \hyperlink{class_config_file_parser_30570b51a5fa559c300e82a9ccb9c4aa}{getValue} (const string \&key) const 
\item 
{\footnotesize template$<$class T $>$ }\\T \hyperlink{class_config_file_parser_8a252769bce21a93b1fa92ef9c13b6e3}{getValue} (const string \&key, const T \&defaultValue) const 
\item 
{\footnotesize template$<$class T $>$ }\\bool \hyperlink{class_config_file_parser_296aa157700b90639969f69a7d111954}{getValueInto} (T \&var, const string \&key) const 
\item 
{\footnotesize template$<$class T $>$ }\\bool \hyperlink{class_config_file_parser_38bc6390578216c1a0bd328ad4d4140f}{getValueInto} (vector$<$ T $>$ \&var, const string \&key) const 
\item 
{\footnotesize template$<$class T $>$ }\\bool \hyperlink{class_config_file_parser_ee6eea46abc71b457ea7b4c5ec93fb5e}{getValueInto} (T \&var, const string \&key, const T \&defaultValue) const 
\item 
string \hyperlink{class_config_file_parser_c4e487d3e4cc636da9224d780970f6b2}{operator\mbox{[}$\,$\mbox{]}} (const string \&key) const 
\item 
\hypertarget{class_config_file_parser_48184d6c852b9a475eb7fd66cc89fc63}{
string \& \textbf{operator\mbox{[}$\,$\mbox{]}} (const string \&key)}
\label{class_config_file_parser_48184d6c852b9a475eb7fd66cc89fc63}

\item 
\hypertarget{class_config_file_parser_2f724bdfc8be6c4cde2be01cdb8521f0}{
mapci \hyperlink{class_config_file_parser_2f724bdfc8be6c4cde2be01cdb8521f0}{begin} () const }
\label{class_config_file_parser_2f724bdfc8be6c4cde2be01cdb8521f0}

\begin{CompactList}\small\item\em Return iterators to the beginning and the end of \_\-contentMap. \item\end{CompactList}\item 
\hypertarget{class_config_file_parser_65e3d858dbdc7ba7820d6305e0e8c60f}{
mapci \textbf{end} () const }
\label{class_config_file_parser_65e3d858dbdc7ba7820d6305e0e8c60f}

\item 
\hypertarget{class_config_file_parser_dbb934115103056dcf61a152937c8e05}{
void \textbf{setFilename} (const string \&f)}
\label{class_config_file_parser_dbb934115103056dcf61a152937c8e05}

\item 
\hypertarget{class_config_file_parser_079e2d914c1f05980f0047bd10396a2d}{
void \textbf{setDelimiter} (const string \&d)}
\label{class_config_file_parser_079e2d914c1f05980f0047bd10396a2d}

\item 
\hypertarget{class_config_file_parser_4909c4db5238ce8a594fe8dfe15e241a}{
void \textbf{setCommentIntroducer} (const string \&c)}
\label{class_config_file_parser_4909c4db5238ce8a594fe8dfe15e241a}

\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{class_config_file_parser_9c4abbf7d07dff071e3769aae4daa016}{add} (string key, const T \&value)
\begin{CompactList}\small\item\em Add a new keys/values. \item\end{CompactList}\item 
void \hyperlink{class_config_file_parser_d8804d36644161483de19ac3131034b6}{remove} (const string \&key)
\begin{CompactList}\small\item\em remove a key \item\end{CompactList}\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{class_config_file_parser_50951123d0aac2820cdfc743781640f4}{setValue} (const string \&key, const T \&value)
\begin{CompactList}\small\item\em Set value associated to a given key. \item\end{CompactList}\item 
void \hyperlink{class_config_file_parser_81a7f31fedf4735e859cdaf3b90695e4}{saveCfgFile} (const string \&filename=\char`\"{}\char`\"{})
\begin{CompactList}\small\item\em Update the configuration file with the content of the map. \item\end{CompactList}\item 
void \hyperlink{class_config_file_parser_f76bcc2c461bf44eada8867d9a8e704c}{printMapContent} (ostream \&os=cout)
\item 
void \hyperlink{class_config_file_parser_99bc6c402c049ccb8f1e6ccd5c6f3a1a}{printCurrentFileContent} (ostream \&os=cout)
\item 
\hypertarget{class_config_file_parser_b41cc003fd74fea1d6b39a4433515b6a}{
{\footnotesize template$<$$>$ }\\void \textbf{setValue} (const string \&key, const bool \&value)}
\label{class_config_file_parser_b41cc003fd74fea1d6b39a4433515b6a}

\item 
\hypertarget{class_config_file_parser_e3b0f8551ebb7f179750eb3d58a08900}{
{\footnotesize template$<$$>$ }\\void \textbf{add} (string key, const bool \&value)}
\label{class_config_file_parser_e3b0f8551ebb7f179750eb3d58a08900}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
\hypertarget{class_config_file_parser_a57ce991e967ddfc2f702207186cae0e}{
ostream \& \textbf{operator$<$$<$} (ostream \&os, const \hyperlink{class_config_file_parser}{ConfigFileParser} \&f)}
\label{class_config_file_parser_a57ce991e967ddfc2f702207186cae0e}

\item 
\hypertarget{class_config_file_parser_4d9770542c2b677248c694d26c518957}{
istream \& \textbf{operator$>$$>$} (istream \&is, \hyperlink{class_config_file_parser}{ConfigFileParser} \&f)}
\label{class_config_file_parser_4d9770542c2b677248c694d26c518957}

\end{CompactItemize}


\subsection{Detailed Description}
This is the main class representing a configuration file and making it possible to read/write configuration entries. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_config_file_parser_418798f2424b5afee0ed1af984080d30}{
\index{ConfigFileParser@{ConfigFileParser}!ConfigFileParser@{ConfigFileParser}}
\index{ConfigFileParser@{ConfigFileParser}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{ConfigFileParser}]{\setlength{\rightskip}{0pt plus 5cm}ConfigFileParser::ConfigFileParser (const string \& {\em filename}, \/  const string \& {\em delimiter} = {\tt \char`\"{}=\char`\"{}}, \/  const string \& {\em comment} = {\tt \char`\"{}\#\char`\"{}})}}
\label{class_config_file_parser_418798f2424b5afee0ed1af984080d30}


Main constructor with a file name. 

Default constructor for class \hyperlink{class_config_file_parser}{ConfigFileParser}, getting keys and values from a given file \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]the name of the configuration file \item[{\em delimiter}]separator between key and value \item[{\em comment}]character(s) used to introduce a comment \end{description}
\end{Desc}


\subsection{Member Function Documentation}
\hypertarget{class_config_file_parser_9c4abbf7d07dff071e3769aae4daa016}{
\index{ConfigFileParser@{ConfigFileParser}!add@{add}}
\index{add@{add}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{add}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void ConfigFileParser::add (string {\em key}, \/  const T \& {\em value})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{class_config_file_parser_9c4abbf7d07dff071e3769aae4daa016}


Add a new keys/values. 

Add a new map (key, value) to \_\-contentMap. If the key already exist, its value is overwritted. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the name of the key \item[{\em value}]the associated value \end{description}
\end{Desc}
\hypertarget{class_config_file_parser_8a252769bce21a93b1fa92ef9c13b6e3}{
\index{ConfigFileParser@{ConfigFileParser}!getValue@{getValue}}
\index{getValue@{getValue}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{getValue}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ T ConfigFileParser::getValue (const string \& {\em key}, \/  const T \& {\em defaultValue}) const\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{class_config_file_parser_8a252769bce21a93b1fa92ef9c13b6e3}


Get the value corresponding to key. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the name of the key \item[{\em defaultValue}]default value to return if the key is not found \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the value corresponding to the key, or defaultValue if the key doesn't exist. \end{Desc}
\hypertarget{class_config_file_parser_30570b51a5fa559c300e82a9ccb9c4aa}{
\index{ConfigFileParser@{ConfigFileParser}!getValue@{getValue}}
\index{getValue@{getValue}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{getValue}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ T ConfigFileParser::getValue (const string \& {\em key}) const\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{class_config_file_parser_30570b51a5fa559c300e82a9ccb9c4aa}


Get the value corresponding to key. Throw \hyperlink{struct_config_file_parser_1_1_key_not_found}{KeyNotFound} when the key doesn't exist \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the name of the key \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the value corresponding \end{Desc}
\hypertarget{class_config_file_parser_ee6eea46abc71b457ea7b4c5ec93fb5e}{
\index{ConfigFileParser@{ConfigFileParser}!getValueInto@{getValueInto}}
\index{getValueInto@{getValueInto}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{getValueInto}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ bool ConfigFileParser::getValueInto (T \& {\em var}, \/  const string \& {\em key}, \/  const T \& {\em defaultValue}) const\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{class_config_file_parser_ee6eea46abc71b457ea7b4c5ec93fb5e}


Get the value corresponding to key and store it in var \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em var}]the variable where the key value will be stored (if the key exists) \item[{\em key}]the name of the key \item[{\em defaultValue}]default value to return if the key is not found \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]'true' if key is found, 'false' otherwise and in that case, var is unchanged. \end{Desc}
\hypertarget{class_config_file_parser_38bc6390578216c1a0bd328ad4d4140f}{
\index{ConfigFileParser@{ConfigFileParser}!getValueInto@{getValueInto}}
\index{getValueInto@{getValueInto}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{getValueInto}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ bool ConfigFileParser::getValueInto (vector$<$ T $>$ \& {\em var}, \/  const string \& {\em key}) const\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{class_config_file_parser_38bc6390578216c1a0bd328ad4d4140f}


Get the value corresponding to key and store it in var \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em var}]the variable where the key value will be stored (if the key exists) \item[{\em key}]the name of the key \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]'true' if key is found, 'false' otherwise and in that case, var is unchanged. \end{Desc}
\hypertarget{class_config_file_parser_296aa157700b90639969f69a7d111954}{
\index{ConfigFileParser@{ConfigFileParser}!getValueInto@{getValueInto}}
\index{getValueInto@{getValueInto}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{getValueInto}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ bool ConfigFileParser::getValueInto (T \& {\em var}, \/  const string \& {\em key}) const\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{class_config_file_parser_296aa157700b90639969f69a7d111954}


Get the value corresponding to key and store it in var \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em var}]the variable where the key value will be stored (if the key exists) \item[{\em key}]the name of the key \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]'true' if key is found, 'false' otherwise and in that case, var is unchanged. \end{Desc}
\hypertarget{class_config_file_parser_c4e487d3e4cc636da9224d780970f6b2}{
\index{ConfigFileParser@{ConfigFileParser}!operator\mbox{[}\mbox{]}@{operator[]}}
\index{operator\mbox{[}\mbox{]}@{operator[]}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{operator[]}]{\setlength{\rightskip}{0pt plus 5cm}string ConfigFileParser::operator\mbox{[}$\,$\mbox{]} (const string \& {\em key}) const}}
\label{class_config_file_parser_c4e487d3e4cc636da9224d780970f6b2}


Faciliate access to a value associated to a key. Throw \hyperlink{struct_config_file_parser_1_1_key_not_found}{KeyNotFound} when the key doesn't exist. The second form enable the writting \mbox{[}i\mbox{]} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the name of the key \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the value associated (may be I shall return an empty string if the key does not exist). \end{Desc}
\hypertarget{class_config_file_parser_99bc6c402c049ccb8f1e6ccd5c6f3a1a}{
\index{ConfigFileParser@{ConfigFileParser}!printCurrentFileContent@{printCurrentFileContent}}
\index{printCurrentFileContent@{printCurrentFileContent}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{printCurrentFileContent}]{\setlength{\rightskip}{0pt plus 5cm}void ConfigFileParser::printCurrentFileContent (ostream \& {\em os} = {\tt cout})}}
\label{class_config_file_parser_99bc6c402c049ccb8f1e6ccd5c6f3a1a}


output file content

Print directly the content of the configuration file. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em os}]\end{description}
\end{Desc}
\hypertarget{class_config_file_parser_f76bcc2c461bf44eada8867d9a8e704c}{
\index{ConfigFileParser@{ConfigFileParser}!printMapContent@{printMapContent}}
\index{printMapContent@{printMapContent}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{printMapContent}]{\setlength{\rightskip}{0pt plus 5cm}void ConfigFileParser::printMapContent (ostream \& {\em os} = {\tt cout})}}
\label{class_config_file_parser_f76bcc2c461bf44eada8867d9a8e704c}


Print map content

Print map content \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em os}]\end{description}
\end{Desc}
\hypertarget{class_config_file_parser_a1acd10524fbfc549c4ae1c6460aff20}{
\index{ConfigFileParser@{ConfigFileParser}!read@{read}}
\index{read@{read}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{read}]{\setlength{\rightskip}{0pt plus 5cm}void ConfigFileParser::read (const string \& {\em filename})}}
\label{class_config_file_parser_a1acd10524fbfc549c4ae1c6460aff20}


Read the configuration file (in case you used the default constructor). 

read keys and values from a given file \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]the name of the configuration file \end{description}
\end{Desc}
\hypertarget{class_config_file_parser_d8804d36644161483de19ac3131034b6}{
\index{ConfigFileParser@{ConfigFileParser}!remove@{remove}}
\index{remove@{remove}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{remove}]{\setlength{\rightskip}{0pt plus 5cm}void ConfigFileParser::remove (const string \& {\em key})}}
\label{class_config_file_parser_d8804d36644161483de19ac3131034b6}


remove a key 

Remove an existing key. Throw \hyperlink{struct_config_file_parser_1_1_key_not_found}{KeyNotFound} if the key doesn't exist. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the key to remove \end{description}
\end{Desc}
\hypertarget{class_config_file_parser_81a7f31fedf4735e859cdaf3b90695e4}{
\index{ConfigFileParser@{ConfigFileParser}!saveCfgFile@{saveCfgFile}}
\index{saveCfgFile@{saveCfgFile}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{saveCfgFile}]{\setlength{\rightskip}{0pt plus 5cm}void ConfigFileParser::saveCfgFile (const string \& {\em filename} = {\tt \char`\"{}\char`\"{}})}}
\label{class_config_file_parser_81a7f31fedf4735e859cdaf3b90695e4}


Update the configuration file with the content of the map. 

Update the configuration file named filename with the content of the map \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]the name of the file to update \end{description}
\end{Desc}
\hypertarget{class_config_file_parser_50951123d0aac2820cdfc743781640f4}{
\index{ConfigFileParser@{ConfigFileParser}!setValue@{setValue}}
\index{setValue@{setValue}!ConfigFileParser@{ConfigFileParser}}
\subsubsection[{setValue}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void ConfigFileParser::setValue (const string \& {\em key}, \/  const T \& {\em value})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{class_config_file_parser_50951123d0aac2820cdfc743781640f4}


Set value associated to a given key. 

Set the value associated to key (throw \hyperlink{struct_config_file_parser_1_1_key_not_found}{KeyNotFound} when the key doesn't exist) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the name of the key \item[{\em value}]the associated value \end{description}
\end{Desc}


The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
/Users/carloshergar/optica/Plasmas/rana-pic/trunk/include/\hyperlink{_config_file_parser_8h}{ConfigFileParser.h}\item 
/Users/carloshergar/optica/Plasmas/rana-pic/trunk/src/\hyperlink{_config_file_parser_8cpp}{ConfigFileParser.cpp}\end{CompactItemize}
